$(function(){
	// 时间-jquery-UI.
	$(".sel-order-time-1").datepicker();
	$(".sel-order-time-2").datepicker();
    <!-- am-btn-group 所有商品 违规下架 的选项卡 -->
    $(".am-btn-group>button").click(function() {
        $(".am-btn-group>button").attr("class", "am-btn am-btn-default am-btn-sm");
        $(this).attr("class", "am-btn am-btn-primary am-btn-sm");
        var getName = $(this).attr("id");
        $(".tab-body").attr("style","display:none");
        $("."+getName+"").attr("style","display:block");
    });
    page();
    deleall();
    deleOne();
});
//时间的验证
function time(time1,time2) {
    
    if (!(time1 == "" || time2 == "")) {
        // 只有输入两个时间 才需要判断 时间合法性.
        var chkFlag = commTemplUtil.checkDate(time1, time2);

        if (!chkFlag) {
            // 不合法--date1 > date2
            commTemplUtil.showErrorDialog({
                title: "注意",
                message: "请检查时间先后顺序!",
                ok_txt: "确定"
            });
            return false;
        }
    }
}
//翻页
function page(){
        // 翻页
    var defaultPagingObj = {
        total: 1,
        pageSize: 3,
        page: 3
    };
    var onClickObj = {
        onClick: function() {
            var clickPage = $(this).attr("data-page");
        }
    };
    var pagingConf = $.extend(defaultPagingObj);

    adminUtil.initPaging('#comm-paging-0', pagingConf);
    adminUtil.initPaging('#comm-paging-1', pagingConf);
}
//选中 删除 效果
function deleall(){
    var tblBody = $("#supplyList-context");
    var tblBody1 = $("#supplyList-context1");
    var selAllChk = $("#sel-all-chk");
    var selAllChk1 = $("#sel-all-chk1");
    tblBody.on("click", ".sel-chk", function () {
            var chkObj = $(this).find(":checkbox");
            var chkVal = chkObj.prop("checked");
            chkObj.prop("checked", !chkVal);
            
            var unChk = tblBody.find(":checkbox:not(:checked)").length;
            selAllChk.prop("checked", (unChk == 0));
        });
    tblBody1.on("click", ".sel-chk", function () {
            var chkObj1 = $(this).find(":checkbox");
            var chkVal1 = chkObj1.prop("checked");
            chkObj1.prop("checked", !chkVal1);
            
            var unChk = tblBody1.find(":checkbox:not(:checked)").length;
            selAllChk1.prop("checked", (unChk == 0));
        });
        // 全选
        selAllChk.on("click", function () {
            var chkAllVal = $(this).prop("checked");
            tblBody.find(":checkbox").prop("checked", chkAllVal);
            
        });
         selAllChk1.on("click", function () {
            var chkAllVal = $(this).prop("checked");
            tblBody1.find(":checkbox").prop("checked", chkAllVal);
            
        });
        $(".del-multi-btn").on("click", function () {
            
            var that = this;
            
            var delIdAry = [];
            tblBody.find(":checked").each(function () {
                delIdAry.push($(this).attr("id"));
            });
            
            if (delIdAry.length == 0) {
                
                var conf = {
                    title : "提示",
                    message : "请选择需要删除的数据!",
                    ok_txt : "确定"
                };
                adminUtil.showMsg(conf);
                
                return false;
            }
            
            // var delMulti = function () {
            //     var delIds = delIdAry.join(",");
            //     delBrand(PAGE_DATA.REST_API.del_multi_url, delIds);
            // };
            
            var conf = {
                title : "来自网页的消息",
                message : "删除后不可恢复，确定删除吗?",
                // ok_func : delMulti,
                ok_context : that,
                ok_param : null
            };
            adminUtil.showConfDialog(conf);
            
        });
}
function deleOne(){
    $(".sel-dele-btn").click(function(){
        var that = this;
        var conf = {
                title : "来自网页的消息",
                message : "删除后不可恢复，确定删除吗?",
                // ok_func : delMulti,
                ok_context : that,
                ok_param : null
            };
            adminUtil.showConfDialog(conf);
    });
}